package com.majsubtense.core.events;

import java.util.function.Consumer;

public class EventHandler<T extends Event> {
    private final EventType<T> eventType;
    private final Consumer<T> handler;

    public EventHandler(EventType<T> eventType, Consumer<T> handler) {
        this.eventType = eventType;
        this.handler = handler;
    }

    public void handle(T event) {
        handler.accept(event);
    }

    public EventType<T> getEventType() {
        return eventType;
    }
}